Skip to content

fix(plugin-grid): a multi-field row conflict lists each field, and a summary column's footer total is formatted as its cells - #33728

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-llrivg
Nov 15, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-llrivg

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread

domain:ui#2 · os-project-manager · session_01FEkQ5mDVzZmSX2UmJXU7sH

Fixes #33557
Fixes #33542

Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 改了什么:① 表格整行保存遇到 409 冲突、且这一行改了多个字段时,冲突对话框按字段逐行列出(列标题、你的修改、当前值),不再把两个整对象打成原始 JSON;只改一个字段的冲突外观不变。② 列表底部合计行里,汇总字段(Field.summary)的合计按它在单元格里的画法格式化:声明了币种(currencyConfig)就按货币,否则按声明的 scale 位小数;都没声明的保持原样。HotCRM 发票列表的「Paid 230,000」因此读作「230,000.00」,与该列单元格一致。
  • 为什么改:① 多字段冲突时对话框只给整行草稿对象,用户看到的是 {"estimate_hours":61,...};fix(ui): console v18.4.0 sweep — connector input reset, per-field conflict list, share page fields, Studio error box wrap #33547 已给对话框加了逐字段列表,表格这条路径还没填。② 合计行的格式化按列类型分支,summary 类型落到兜底分支,从不读 scale;实测 showcase 服务端返回的汇总字段带 scale: 2,缺口在 ui。
  • 风险与回滚:只动 @object-ui/plugin-grid 内部和 @object-ui/fields 新增一个导出 summaryDeclaresCurrency(单元格本就用它判断汇总字段是否为货币,现在合计行复用同一个判断,不另写格式化器)。货币与否按汇总字段自己的 currencyConfig,不看被汇总的源字段类型,这是 spec 的规定,席位已认可。回滚即 revert 本 PR。
  • 先看:ui/packages/plugin-grid/src/useColumnSummary.ts 的 summaryValueType 及 formatSummaryLabel 里改为调用它的那一行;ui/packages/plugin-grid/src/ObjectGrid.tsx 的 buildRowConflict 新增的 fields。
  • 两分钟验证:pnpm --dir ui exec vitest run packages/plugin-grid/src/__tests__/footerSummaryFieldScale-33542.test.tsx packages/plugin-grid/src/__tests__/inlineEditConflictFields-33557.test.tsx,预期 7 个用例全绿。
  • 需要你做的:无,席位落地。

What changes

#33557, a multi-field grid row conflict lists each field. buildRowConflict in ObjectGrid.tsx now fills the conflict's fields list (#33547's ConcurrentUpdateFieldConflict: field, label, your edit, current value) when a row save changed more than one field, labelled by the column header (columnHeaderOf, the label the one-field conflict already uses). The dialog then draws one row per field instead of the two whole-map previews. A one-field conflict is built exactly as before.

#33542, a summary column's footer total is formatted as its cell. The footer formatter (formatSummaryLabel in useColumnSummary.ts) chooses its arm by the column type, and a summary column fell to the plain default, which never reads scale. A new summaryValueType routes a summary into the arm the list cell draws the same field with (FormulaCellRenderer): currency when the summary declares its currency (summaryDeclaresCurrency, the cell's own predicate, now exported from @object-ui/fields), else number when resolveFieldScale answers a width, else the plain default as today. No second formatter: the existing currency arm (formatCurrency) and number arm (resolveFieldScale) do the formatting.

Measured first, as the triage asked. On a live showcase (origin/main d95ddeb, objectstack dev), GET /api/v1/meta/object/showcase_expense_report serves the summary fields with their scale, e.g. total_amount: {"type":"summary","scale":2,"summaryOperations":{"object":"showcase_expense_line","field":"amount","function":"sum"}}, no currencyConfig. The source showcase_expense_line.amount is served as type: currency on its own object. So the scale reaches the console and the gap was the footer.

Tests

  • ui/packages/plugin-grid/src/__tests__/inlineEditConflictFields-33557.test.tsx, new. The real ObjectGrid, data-table and ConcurrentUpdateDialog; writes go through the real @object-ui/data-objectstack adapter and @objectstack/client, with only fetch stubbed by a server answering a stale If-Match with the 409 CONCURRENT_UPDATE envelope. Cells are edited by click, typing and Enter, then the row's Save is clicked.
    • Two changed fields + a 409: the dialog lists two rows, estimate_hours under "Estimate" (61 / 77) and owner_note under "Owner note" (shipped / blocked), and its text holds no { or }.
    • CONTROL: one changed field shows no list, names "Estimate" and both values.
  • ui/packages/plugin-grid/src/__tests__/footerSummaryFieldScale-33542.test.tsx, new. The real ObjectGrid footer, its field catalogue read from the data source's object schema, under a real I18nProvider.
    • en: a summary with scale: 2 totals to Sum: 230,000.00; zh-CN: 合计:230,000.00.
    • en and zh-CN: a summary declaring a fixed CNY currency totals exactly as a plain currency column with the same config does (money, not a bare number).
    • CONTROL: a summary with no scale and no currency keeps the plain total (Sum: 7).

Ablations at head eed5643b (scripts/ablation-replace.mjs; the tests import plugin-grid and @object-ui/fields from src/ through the ui vitest alias, so no dist is in the path):

#33557: buildRowConflict without the fields list → the multi-field case red, the control green; restored
anchor "      fields: keys.map((k) => ({" → "      _ablated: keys.map((k) => ({"
ablation-replace: ok mutation landed: anchor 1 -> 0, blob 7c4d76f5dbd4 -> 3be11d0556d5
× two changed fields + a 409: two rows, each under its column header with both values, no raw JSON
Tests  1 failed | 1 passed (2)
ablation-replace: ok restored: blob == HEAD (7c4d76f5dbd4) and `git diff HEAD` is empty
#33542: the summary routing switched off → the four scale and currency cases red, the control green; restored
anchor "column?.type === 'summary' ? summaryValueType(column) : column?.type"
     → "column?.type === 'summary' && String('ABL').length < 0 ? summaryValueType(column) : column?.type"
ablation-replace: ok mutation landed: anchor 1 -> 0, blob 7803efa5aef8 -> 9ba5b6deda4a
× en: a summary with scale 2 totals to two decimals
× zh-CN: a summary with scale 2 totals to two decimals, under the zh prefix
× en: a summary declaring a fixed currency totals as a plain currency column does
× zh-CN: a summary declaring a fixed currency totals as a plain currency column does
Tests  4 failed | 1 passed (5)
ablation-replace: ok restored: blob == HEAD (7803efa5aef8) and `git diff HEAD` is empty

Acceptance notes

  • Money follows the summary's own currencyConfig, not its source field's type (seat accepted this reading). The card asks for the currency format "when its source field is currency". The spec's currencyConfig describe says "Absent: dynamic mode, and no currency on a summary", and the list cell (FormulaCellRenderer) draws a summary as money only when summaryDeclaresCurrency holds. The footer follows the same rule, so footer and cell agree. HotCRM's All Invoices paid_amount (Field.summary, scale: 2, no currencyConfig, summing currency crm_payment.amount) therefore totals as 230,000.00, matching its cells; a HotCRM author who wants it drawn as money declares currencyConfig: { currencyMode: 'fixed', ... } on the summary. The HotCRM result is read from a fixture of the same shape in the pin above, not from a live HotCRM run.
  • A formula column's footer total also falls to the plain default arm (the cell draws it by returnType). Not measured on a real producer here; noted only.

Verification

Local, at head eed5643b (rebased on origin/main 5604aeb), each exit code captured before any pipe:

  • pnpm --dir ui exec vitest run packages/plugin-grid/ --maxWorkers=2 under the verify lock: Test Files 283 passed (283), Tests 2443 passed (2443), the two new files included.
  • pnpm --filter @object-ui/fields run type-check and pnpm --filter @object-ui/plugin-grid run type-check (each tsc --noEmit && tsc -p tsconfig.test.json, so the new tests are type-checked): exit 0, after building the @object-ui/plugin-grid^... closure.
  • pnpm check:new-line-citations (ui, run by hand per ui/AGENTS.md Migrate documentation site to Fumadocs with monorepo structure and shared content #11): 0 new citations.
  • Derived gate families (node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack): 39 derived, 39 run, all exit 0; --ran reconciles: "39 derived famil(ies) accounted for — 39 run, 0 NOT-MEASURED".
the 39 derived families, each COMMAND :: exit N
node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0
node scripts/check-adr-0087-registration.mjs --self-test :: exit 0
node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/check-empty-changeset.mjs --base origin/main :: exit 0
node scripts/check-empty-changeset.mjs --self-test :: exit 0
node scripts/check-sdui-manifest.mjs :: exit 0
node scripts/check-sdui-manifest.mjs --self-test :: exit 0
node scripts/ci/snapshot-next.mjs --self-test :: exit 0
node scripts/pm/check-governed-queue-guard.mjs --self-test :: exit 0
node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0
node scripts/release-pending-publish.mjs --self-test :: exit 0
pnpm --dir ui exec vitest run scripts/ :: exit 0
pnpm --filter @objectstack/spec run check:duration-unit-keys :: exit 0
pnpm --filter @objectstack/spec run check:error-code-provenance :: exit 0
pnpm check:changeset-gate-self-tests :: exit 0
pnpm check:closed-ceremony-text :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:dispatcher-error-vocabulary :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:engine-double-contract :: exit 0
pnpm check:error-status-conformance :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:published-files :: exit 0
pnpm check:query-options-erasure :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:registry-log-declared :: exit 0
pnpm check:rest-log-spy-declared :: exit 0
pnpm check:skill-identifier-liveness :: exit 0
pnpm check:test-source-alias :: exit 0
pnpm check:tier-file-adoption :: exit 0
pnpm check:type-check-coverage :: exit 0
pnpm check:type-check-debt :: exit 0
pnpm check:undeclared-dep-imports :: exit 0
pnpm check:watch-hint-literal :: exit 0
pnpm check:where-matcher :: exit 0

The repo-wide scans, the test:repo project and every family CI runs beyond the derived list are CI's (Test UI, Type Check UI and the lint farm).


Generated by Claude Code

…at a summary column's footer total as its cell

A grid row save that changed several fields and met a 409 now fills the
conflict dialog's per-field list (column header, your edit, current value)
instead of handing it the draft map, which printed as raw JSON.

The footer total of a roll-up (summary) column now takes the arm the list
cell draws the same field with: money when the summary declares its
currency, else a number at its declared scale. @object-ui/fields exports
summaryDeclaresCurrency, the cell's own test, for the footer to reuse.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5mDVzZmSX2UmJXU7sH
@github-actions github-actions Bot added documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 15, 2026
@objectstack-fleet objectstack-fleet Bot added the needs:contract-review Marker only — PR awaits its at-tier Contract review PASS; no check reads it, the record decides label Nov 15, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#2 · os-project-manager · session_01FEkQ5oF8GgTHN2jBZoDwz8

Contract review

Served-tier: TIER_DEFAULT
Head-sha: eed5643b0415761ea58b161eebc4347e63426c47
Local-runs: none

Inputs: #33557 (body and 3 comments), #33542 (body and 4 comments, including claim amendment 04:25Z), the PR #33728 body, its 6-file list and net diff against main, and the check-runs on this head. The head was resolved with gh api .../pulls/33728 and is still eed5643b. Code at the head was read with git show; nothing was built, run or re-run.

① Derived judgments

J1 · @object-ui/fields newly exports summaryDeclaresCurrency. Right. This is a pure widening.

J2 · summaryValueType in plugin-grid/src/useColumnSummary.ts. Right. It agrees with the list cell. summary is registered to FormulaCellRenderer in fields/src/index.tsx.

  • Money: the cell draws a summary as money when type === 'summary' and summaryDeclaresCurrency, through CurrencyCellRenderer. The footer goes to the existing currency arm (formatCurrency) on the same test.
    • A record roll-up never gets this far. recordCurrencyField skips sum/avg/min/max for it earlier (ADR-0144 D6), so only a fixed summary reaches this arm. That matches the spec's currencyConfig rule on main ("Absent: dynamic mode, and no currency on a summary").
  • Number: otherwise the cell draws NumberCellRenderer at resolveFieldScale(field). The footer goes to the number arm at resolveFieldScale(column), which gets the same type and scale.
  • Neither currency nor scale: ABSENT_SCALE_BY_TYPE holds only percent, so resolveFieldScale returns undefined for a scale-less summary. colType then stays 'summary' and falls to the same avg / plain toLocaleString arms as before. The old output is kept, which is console list footer: the total of a summary field (Field.summary, scale 2) renders without decimals ("Paid 230,000" next to a currency "Open 215,000.00") #33542 acceptance 2. CONTROL Sum: 7 pins this.
  • Nit: without a scale, the cell draws at natural precision through NumberCellRenderer, while the footer keeps the plain default. That difference existed before this PR, and the card's acceptance 2 keeps it.
  • Callers outside the footer: useColumnSummary is a public hook, and its label now changes for summary columns that declare a scale or a fixed currency. This is a display fix in internal formatting. It does not narrow any accept-set.

J3 · buildRowConflict in plugin-grid/src/ObjectGrid.tsx. Right.

  • The multi-field branch now fills ConcurrentUpdateConflict.fields. Each entry has field, label, pendingValue and currentValue, matching fix(ui): console v18.4.0 sweep — connector input reset, per-field conflict list, share page fields, Studio error box wrap #33547's ConcurrentUpdateFieldConflict. One entry is made per changed key, in draft order.
  • Labels come from columnHeaderOf(k), which reads the grid's own orderedColumns headers. This is the source the one-field label already used, and it is what the card asked for ("labels from the grid's columns"). When a header is not a string, the dialog falls back to the machine name (row.label || row.field).
  • The one-field branch has no diff, so a one-field conflict is unchanged.
  • The whole-map pendingValue / currentValue stay on the multi-field payload for the overwrite path. The dialog does not draw them when fields is non-empty, so no raw JSON is drawn for scalar or scalar-array values. The pin checks for no { or }, and its CONTROL checks the one-field face.
  • Nit, outside the diff: the dialog's formatValue still prints a field whose value is an object (for example an expanded lookup) with JSON.stringify. That code belongs to plugin-detail, not to this PR.

Pins: the two new tests run against the rendered grid, and each has a CONTROL. The ablations quoted in the PR body (fields ablated: 1 red / 1 green; summary routing switched off: 4 red / 1 green) are the dev's report. This review did not re-run them.

② Semver level

Right.

③ Boundary flags

Implemented-by: claude/project-thread-llrivg
Reviewed-by: session_01FEkQ5oF8GgTHN2jBZoDwz8

VERDICT: PASS

@objectstack-fleet objectstack-fleet Bot removed the needs:contract-review Marker only — PR awaits its at-tier Contract review PASS; no check reads it, the record decides label Nov 15, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#2 · os-project-manager · session_01FEkQ5oF8GgTHN2jBZoDwz8

席位核对

Verdict: ACCEPT · head eed5643b · 2026-11-15T08:36Z

  1. Shape. Draft → main, Fixes #33557 and Fixes #33542. 6 files, +402/−4:

    All of it is on the claimed surface, as amended. The PR is rebased onto main after ui seat 1's fix(plugin-list, plugin-kanban, plugin-grid, app-shell): cards whose click opens nothing draw no pointer, and an authored none row opens no tab on a modifier click #33671 (ObjectGrid.tsx) merged.

  2. Premise and fix.

  3. Declarations. Clause-②: yes (widening) on @object-ui/fields (the new summaryDeclaresCurrency export), Metadata-protocol: none, patch. That is right. Contract record PASS 6891601341 on eed5643b (TIER_DEFAULT).

  4. Accepted reading (console list footer: the total of a summary field (Field.summary, scale 2) renders without decimals ("Paid 230,000" next to a currency "Open 215,000.00") #33542). Money follows the summary's own currencyConfig, as the spec's describe says, not its source field's type. HotCRM's paid_amount (scale: 2, no currencyConfig) therefore totals as 230,000.00, matching its cells. A HotCRM author who wants it shown as money declares currencyConfig on the summary.

  5. Cross-card note. The spec seat's open PR feat(spec, fields): a roll-up of a stored home amount declares currencyMode dynamic and is drawn in the home currency #33710 (A summary over a stored home-currency amount is drawn as a bare number, and no summary currencyConfig can say "the home currency" without naming it #33659) widens summaryDeclaresCurrency to count currencyMode: dynamic summaries. The footer reuses that predicate, so it follows automatically, and the merge queue re-tests whichever of the two lands second.

  6. Noted, not filed. A formula column's footer total also falls to the plain default arm. The dev noted this without measuring it on a real producer, so it does not meet the filing gate.

  7. Gates on head eed5643b: All 65 check runs are success (46) or skipped (19). The dev's local run: 39/39 derived gates exit 0, and the plugin-grid suite passes 283 files / 2443 tests.

  8. K. 8 first-parent commits since base 5604aeb0 (< 15): no base sync owed. Path face: not governed; 406 changed lines.

  9. Authority. Landing under the maintainer's standing authorisation 「按照 pm-dispatch 规则复核过的都授权」 (2026-10-25T11:35Z).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 15, 2026 08:37
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit f06f064 Nov 15, 2026
66 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-llrivg branch November 15, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

1 participant